<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% content_for :page_title do %><%= @actual_rubric.title %><% end %>
<% add_crumb t('#crumbs.rubrics', 'Rubrics'), context_url(@context, :context_rubrics_url) %>
<% add_crumb @actual_rubric.title %>

<% content_for :right_side do %>
  <% if can_do(@actual_rubric, @current_user, :update) %>
    <a href="#" class="edit_rubric_link Button button-sidebar-wide"><i class="icon-edit" aria-hidden="true"></i> {{#t}}Edit Rubric{{/t}}</a>
  <% else %>
      {{#t}}Rubrics cannot be modified once they have been used in more than one place.{{/t}}
  <% end %>
  <% if can_do(@actual_rubric, @current_user, :delete) %>
    <a href="#" class="delete_rubric_link Button button-sidebar-wide"><i class="icon-trash" aria-hidden="true"></i> {{#t}}Delete Rubric{{/t}}</a>
  <% end %>
  <a href="<%= context_url(@context, :context_rubrics_url) %>" class="rubrics_url" style="display: none;">&nbsp;</a>
<% end %>

<% js_bundle :edit_rubric %>
<% css_bundle :learning_outcomes %>
<% content_for :stylesheets do %>
  <style>
    #rubrics .find_rubric_link {
      display: none;
    }
    #rubrics .rubric_title .links {
      display: none;
    }
  </style>
<% end %>
<% js_bundle 'legacy/rubrics_show' %>
<h1><%= @actual_rubric.title %></h1>
<div id="rubrics" class="raw_listing">
  <% [@actual_rubric].each do |rubric| %>
    {{> views/shared/rubric}}
  <% end %>
  <div style="display: none;" id="rubric_parameters">
    <input type="hidden" name="rubric_association[association_type]" value="<%= @context.class.to_s %>"/>
    <input type="hidden" name="rubric_association[association_id]" value="<%= @context.id %>"/>
    <input type="hidden" name="rubric_association[purpose]" value="bookmark"/>
  </div>
  <span class="current_user_id" style="display: none;"><%= @current_user.id %></span>
  <a href="<%= context_url(@context, :context_rubrics_url) %>" class="add_rubric_association_url" style="display: none;">&nbsp;</a>
</div>
{{> views/shared/find_outcome}}
{{> views/shared/rubric}}
{{> views/shared/rubric_forms}}
{{> views/shared/rubric_criterion_dialog}}
